/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.sisportaria.bean;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author lac
 */
@Entity
@Table(name = "VIATURA")
@NamedQueries({@NamedQuery(name = "Viatura.findAll", query = "SELECT v FROM Viatura v"), @NamedQuery(name = "Viatura.findByVtncodg", query = "SELECT v FROM Viatura v WHERE v.vtncodg = :vtncodg"), @NamedQuery(name = "Viatura.findByVtcmarc", query = "SELECT v FROM Viatura v WHERE v.vtcmarc = :vtcmarc"), @NamedQuery(name = "Viatura.findByVtcmodl", query = "SELECT v FROM Viatura v WHERE v.vtcmodl = :vtcmodl"), @NamedQuery(name = "Viatura.findByVtdano", query = "SELECT v FROM Viatura v WHERE v.vtdano = :vtdano"), @NamedQuery(name = "Viatura.findByVtcplac", query = "SELECT v FROM Viatura v WHERE v.vtcplac = :vtcplac"), @NamedQuery(name = "Viatura.findByVtnodom", query = "SELECT v FROM Viatura v WHERE v.vtnodom = :vtnodom")})
public class Viatura implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "VTNCODG")
    private Integer vtncodg;
    @Column(name = "VTCMARC")
    private String vtcmarc;
    @Column(name = "VTCMODL")
    private String vtcmodl;
    @Column(name = "VTDANO")
    @Temporal(TemporalType.DATE)
    private Date vtdano;
    @Column(name = "VTCPLAC")
    private String vtcplac;
    @Column(name = "VTNODOM")
    private Integer vtnodom;

    public Viatura() {
    }

    public Viatura(Integer vtncodg) {
        this.vtncodg = vtncodg;
    }

    public Integer getVtncodg() {
        return vtncodg;
    }

    public void setVtncodg(Integer vtncodg) {
        Integer oldVtncodg = this.vtncodg;
        this.vtncodg = vtncodg;
        changeSupport.firePropertyChange("vtncodg", oldVtncodg, vtncodg);
    }

    public String getVtcmarc() {
        return vtcmarc;
    }

    public void setVtcmarc(String vtcmarc) {
        String oldVtcmarc = this.vtcmarc;
        this.vtcmarc = vtcmarc;
        changeSupport.firePropertyChange("vtcmarc", oldVtcmarc, vtcmarc);
    }

    public String getVtcmodl() {
        return vtcmodl;
    }

    public void setVtcmodl(String vtcmodl) {
        String oldVtcmodl = this.vtcmodl;
        this.vtcmodl = vtcmodl;
        changeSupport.firePropertyChange("vtcmodl", oldVtcmodl, vtcmodl);
    }

    public Date getVtdano() {
        return vtdano;
    }

    public void setVtdano(Date vtdano) {
        Date oldVtdano = this.vtdano;
        this.vtdano = vtdano;
        changeSupport.firePropertyChange("vtdano", oldVtdano, vtdano);
    }

    public String getVtcplac() {
        return vtcplac;
    }

    public void setVtcplac(String vtcplac) {
        String oldVtcplac = this.vtcplac;
        this.vtcplac = vtcplac;
        changeSupport.firePropertyChange("vtcplac", oldVtcplac, vtcplac);
    }

    public Integer getVtnodom() {
        return vtnodom;
    }

    public void setVtnodom(Integer vtnodom) {
        Integer oldVtnodom = this.vtnodom;
        this.vtnodom = vtnodom;
        changeSupport.firePropertyChange("vtnodom", oldVtnodom, vtnodom);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vtncodg != null ? vtncodg.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Viatura)) {
            return false;
        }
        Viatura other = (Viatura) object;
        if ((this.vtncodg == null && other.vtncodg != null) || (this.vtncodg != null && !this.vtncodg.equals(other.vtncodg))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sisportaria.view.Viatura[vtncodg=" + vtncodg + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
